﻿@using System.Data
@{
    ViewBag.Title = "Window";
    Layout = "~/Areas/Admin/Views/Shared/AdminLayout.cshtml";
    DataTable table = ViewData["data"] as DataTable;
}


<input name="id" id="id" type="hidden" value="0" />
<table class="edit_table">
    <tr>
        <td><label>选择快递</label></td>
        <td>
            <select id="wlname">
                <option value="0">选择物流</option>
                @{
                    foreach (DataRow row in table.Rows)
                    {
                        <option value="@row["Id"]">@row["ExpressName"]</option>
                    }
                }
            </select>
        </td>
    </tr>
    <tr>
        <td><label>物流编号</label></td>
        <td><input type="text" id="no" name="no" style="width: 300px;" /></td>
    </tr>
    <tr>
        <td colspan="2">
            <div class="botton" style="margin-left: 50px;" onclick="edit()">保存</div>
            <div class="botton" style="margin-left: 50px;" onclick="javascript: history.go(-1);">取消</div>
        </td>
    </tr>
</table>


<script>
    var orderno = "@ViewData["orderno"]";
    function edit() {
        var no = $("#no").val();
        if (no.trim() == "") {
            alert("请输入快递单号！");
            return false;
        }
        var wlname = $("#wlname").val();
        if (wlname == 0) {
            alert("请选择物流！");
            return false;
        }
      
        $.post("@Url.Action("fh")", { orderno: orderno, wlid: wlname, danhao: no }, function (row) {
            if (row > 0) {
                alert("操作成功！");
                location.href = "@Url.Action("OrderList3")";
            } else {
                alert("添加失败！");
            }
           

        });
    }

</script>
